package org.dromara.web.controller.app;


import cn.dev33.satoken.annotation.SaIgnore;
import org.dromara.common.core.domain.R;
import org.dromara.dao.business.domain.Article;
import org.dromara.web.service.business.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/app/article")
public class AppArticleController {

    @Autowired
    ArticleService articleService;


    @SaIgnore
    @GetMapping("/detail")
    public R<Article> getArticleById(Long id,@RequestHeader("Content-Language")String lang) {
        return R.ok(articleService.getI18nArticle(id, lang));
    }


    @SaIgnore
    @GetMapping("/privacy")
    public R<Article> getPrivacyArticle() {
        return R.ok(articleService.getPrivacyArticle("zh-Hans"));
    }

    @SaIgnore
    @GetMapping("/service")
    public R<Article> getServiceArticle() {
        return R.ok(articleService.getServiceArticle("zh-Hans"));
    }

}
